import {createRouter,createWebHistory} from "vue-router";
import Layout from "@/layout/index.vue"
const modulesFiles = import.meta.globEager('./modules/*.js')
export const asyncRoutes = []
Object.keys(modulesFiles).forEach(item=>{
    modulesFiles[item].default.forEach(item=>{
        asyncRoutes.push(item)
    })
})
export const constantRoutes=[{
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: asyncRoutes,
},{
    path: '/404',
    component: ()=>import("@/view/error/404.vue"),
},{
    path: '/401',
    component: ()=>import("@/view/error/401.vue"),
}]

export default createRouter({
    history: createWebHistory(),
    routes:constantRoutes,
})